using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;

namespace InverseClockWork.Extra.Cutscenes
{
    public class ReroutingDialogCharacterMarker : MonoBehaviour
    {
        private static List<ReroutingDialogCharacterMarker> Markers
        {
            get; set;
        } = new List<ReroutingDialogCharacterMarker>();

        public static ReroutingDialogCharacterMarker GetCharacter(string chrName)
        {
            return Markers.Where(item => item.IDName == chrName).FirstOrDefault();
        }

        [SerializeField]
        private string _idName, _reportedName;
        [SerializeField]
        private bool _noVisualName;

        public string IDName { get => _idName; private set => _idName = value; }
        public string ReportedName { get => _reportedName; private set => _reportedName = value; }
        private bool NoVisualName { get => _noVisualName; set => _noVisualName = value; }

        public string VisualName
        {
            get
            {
                if (NoVisualName)
                {
                    return string.Empty;
                }
                if (ReportedName.Length > 0)
                {
                    return ReportedName;
                }
                return IDName;
            }
        }

        

        private void OnEnable()
        {
            Markers.Add(this);
        }

        private void OnDisable()
        {
            Markers.Remove(this);
        }
    }
}